#!perl

use 5.010;
use strict;
use warnings;

use Test::More tests => 2;

use JasPerl::Util::Date;
use Time::Piece;
use DateTime;
use DateTime::Format::CLDR;

my $now = JasPerl::Util::Date->new();
my $dt = DateTime->from_epoch(epoch => $now->get_time() / 1000);
my $epoch = DateTime->from_epoch(epoch => 0);
my $date = JasPerl::Util::Date->from($dt);

isa_ok $date, 'JasPerl::Util::Date';
is int($date->get_time() / 1000), $dt->epoch;

my $format = DateTime::Format::CLDR->new(
    pattern => 'YYYY-MM-dd HH:mm:ss.SSS'
    );
warn $format->format_datetime($dt);
warn $format->format_datetime($epoch);
